Generate internal links to our options in the doc.
authorrobertl <robertl>
Sun, 17 Aug 2008 21:43:56 +0000 (21:43 +0000)
committerrobertl <robertl>
Sun, 17 Aug 2008 21:43:56 +0000 (21:43 +0000)
xmldoc/formats/options/osm-created_by.xml [new file with mode: 0644]
xmldoc/makedoc.in

diff --git a/xmldoc/formats/options/osm-created_by.xml b/xmldoc/formats/options/osm-created_by.xml
new file mode 100644 (file)
index 0000000..bb0b8cd
--- /dev/null
@@ -0,0 +1,22 @@
+<para> Use this value as custom created_by value in an OSM file.</para>
+
+<para>
+With this pption, the given string is added as the 'created_by' field in 
+all the created nodes and ways.
+</para>
+
+<para>
+<userinput>
+gpsbabel -i INTYPE -f INFILE -o osm,created_by=somestring -O out.osm
+</userinput>
+</para>
+
+<para>
+  If an empty string is given, the 'created_by' tag is omitted altogether.
+</para>
+
+<para>
+<userinput>
+gpsbabel -i INTYPE -f INFILE -o osm,created_by= -O out.osm
+</userinput>
+</para>
index e807de9da7b3b5ea2d7add85124ec9838567963b..fbbe444f653d3b08e89cffb136e5d767de77acac 100755 (executable)
@@ -1,9 +1,11 @@
 #!/usr/bin/perl
 
 #
-# makedoc.in is used to generate makedoc.  
+# makedoc.in is used to generate makedoc.   Editing makedoc is a bad ide.
 #
 
+@options;
+
 sub expandrw {
    my $read = shift;
    my $write = shift;
@@ -39,6 +41,25 @@ sub expandoptions {
    $res;  
 }
 
+sub expandsuboptions {
+  my $f = shift;
+  my $res;
+  $olist = $options{$f};
+
+  # If no options, don't clutter things.
+  if ($olist eq "") { return; }
+
+  # Comma separate the human-readable variation.
+  $olist =~ s/> </>, </g;
+  $res .= "<para>This format has the following options: ";
+  $res .= $olist;
+  $res .= ".</para>";
+  $res;
+}
+
+
 sub include {
    my $name=shift;
    my $dir2=shift;
@@ -86,6 +107,33 @@ print FORMATS qq(<!-- This document is automatically generated. -->\n);
 $going = 0;
 $dooptions = 0;
 
+# Prescan the argument list for options.
+
+for (@formats) {
+   chomp;
+   s/\&/\&amp;/g;
+   s/</\&lt;/g;
+   s/>/\&gt;/g;
+   @line = split "\t";
+
+   if (($line[0] eq 'file') || ($line[0] eq 'serial')) {
+       $fmt = $line[2];
+       # Pennance for earlier sins.  Rename magellan -> magellan1 here.
+       if ($line[4] eq "Magellan serial protocol") {
+        $fmt = "magellan1";
+       }
+       $skipping = 0;
+   }
+   if ( $line[0] eq 'internal' || $line[5] eq 'xcsv') {
+       $skipping = 1;
+   }
+   if ($line[0] eq 'option' && $skipping == 0) {
+     $optname = $line[2];
+
+     $options{$fmt} .= "<link linkend=\"fmt_${fmt}_o_${optname}\">$optname</link> ";
+   }
+}
+
 
 for (@formats) {
    chomp;
@@ -125,6 +173,7 @@ for (@formats) {
   <title>$line[4] ($line[2])</title>
 END
      print FILE expandoptions($line[1]);
+     print FILE expandsuboptions($id);
      $going = 1;
      $dooptions = 1;
      if ( defined($line[5]) && ($line[5] ne $line[2]) ) {